// =============================================================================
//  STATS - Statistical Analysis Tools, v.0.01
//  Copyright (C) 2012  Marco Vettigli
// -----------------------------------------------------------------------------
//
// This program  is free software:  you can  redistribute it and/or  modify it
// under the terms of the  GNU General Public License as published by the Free
// Software Foundation,  either version 3 of the License,  or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY;  without even  the  implied  warranty  of  MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License  for
// more details.
//
// You  should  have received a copy of the  GNU General Public License  along
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// =============================================================================
//
// DIALOGINSERTCOLUMNS.H
// The class defines a graphical user interface for columns insertion.
//
// Author: Marco Vettigli
//
// =============================================================================

#ifndef DIALOGINSERTCOLUMNS_H
#define DIALOGINSERTCOLUMNS_H

// == include directives =======================================================

#include <QDialog>
#include "core/scolproperty.h"

// == class definitions ========================================================

namespace Ui {
    class DialogInsertColumns;
}

class DialogInsertColumns : public QDialog
{

    Q_OBJECT

public:

// == constructors and destructors =============================================

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::DialogInsertColumns(QWidget*)
    //
    // Default constructor for DialogInsertColumns class.
    //
    // -------------------------------------------------------------------------
    explicit DialogInsertColumns(QWidget *parent = 0);

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::~DialogInsertColumns()
    //
    // Default destructor for DialogInsertColumns class.
    //
    // -------------------------------------------------------------------------
    ~DialogInsertColumns();

// == enums ====================================================================

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::Position
    //
    // Enum to define column insertion position.
    //
    // -------------------------------------------------------------------------
    enum Position { Begin, End, AfterSelected, BeforeSelected };

// == getters ==================================================================

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::getColumnName()
    //
    // Returns the name of the column present in line edit "name".
    //
    // -------------------------------------------------------------------------
    QString getColumnName() const;

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::getColumnNumber()
    //
    // Returns the number of the column to be inserted present in spin box
    // "number".
    //
    // -------------------------------------------------------------------------
    int getColumnNumber() const;

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::getColumnType()
    //
    // Returns the type of columns to be inserted based on selection of combo
    // box "content".
    //
    // -------------------------------------------------------------------------
    StatS::SColProperty::ArrayType getColumnType() const;

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::getInsertionPosition()
    //
    // Returns the insertion position of columns to be inserted present
    // depending on form checkboxes.
    //
    // -------------------------------------------------------------------------
    DialogInsertColumns::Position getInsertionPosition() const;

// == setters ==================================================================

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::setColumnName(const QString)
    //
    // The function sets the content of line edit "name" with "name" string.
    //
    // -------------------------------------------------------------------------
    bool setColumnName(const QString name);

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::setColumnNumber(int)
    //
    // The function sets the content of spin box "number" with 'number'. The
    // argument 'number' must obviously be equal or greater than one.
    //
    // -------------------------------------------------------------------------
    bool setColumnNumber(int number);

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::setColumnType(SColProperty::ArrayType)
    //
    // The function sets the selection of combo box "content" based on
    // ArrayType 'type'.
    //
    // -------------------------------------------------------------------------
    bool setColumnType(const StatS::SColProperty::ArrayType type);

    // -- public ---------------------------------------------------------------
    // DialogInsertColumns::setInsertionPosition(DialogInsertColumns::Position)
    //
    // The function sets the insertion position of the dialog based on
    // Position 'pos'.
    //
    // -------------------------------------------------------------------------
    bool setInsertionPosition(DialogInsertColumns::Position pos);

// == inspectors ===============================================================

// == accessor function declarations ===========================================

// == variable declarations ====================================================

private:

    Ui::DialogInsertColumns *ui;        // user interface pointer

// == private function declarations ============================================

private slots:

    // -- private --------------------------------------------------------------
    // DialogInsertColumns::on_buttonBox_accepted()
    //
    // This fuction handles the button box "OK", accepting and closing the
    // dialog.
    //
    // -------------------------------------------------------------------------
    void on_buttonBox_accepted();

    // -- private --------------------------------------------------------------
    // DialogInsertColumns::on_buttonBox_rejected()
    //
    // This fuction handles the button box "Cancel", rejecting and closing the
    // dialog.
    //
    // -------------------------------------------------------------------------
    void on_buttonBox_rejected();

};

#endif // DIALOGINSERTCOLUMNS_H
